package com.gaofans.vertx.boot.test.controller;

import com.gaofans.vertx.boot.web.annotation.ExceptionHandler;
import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;


/**
 * @author GaoFans
 */
//@com.gaofans.vertx.boot.web.annotation.ExceptionAdvice
public class ExceptionAdvice {

    @ExceptionHandler(value = RuntimeException.class,status = 400)
    public Handler<RoutingContext> handler(){
        return routingContext -> {
            int statusCode = routingContext.response().getStatusCode();
            System.out.println(statusCode);
            routingContext.response().setChunked(true);
            routingContext.response().write("123");
            routingContext.next();
        };
    }
}
